package com.lottery.game.core.model.dto;

import com.lottery.game.common.BaseObject;
import com.lottery.game.core.modules.entity.user.GameUser;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserToken extends BaseObject {
    /**
     * 用户编号
     */
    private String id;

    /**
     * 用户名
     */
    private String username;

    /**
     * 真实信息
     */
    private String nickname;

    /**
     * 手机号
     */
    private String phone;

    /**
     * 登陆时间
     */
    private Long loginTime;

    /**
     * 签名
     */
    private String sign;


    public static UserToken toUserToken(GameUser user) {
        UserToken userToken = new UserToken();
        userToken.setId(user.getId());
        userToken.setUsername(user.getUsername());
        userToken.setPhone(user.getPhone());
        userToken.setLoginTime(System.currentTimeMillis());
        userToken.setNickname(user.getNickname());
        return userToken;
    }
}
